/**
 * 1750. 删除字符串两端相同字符后的最短长度
 * @param {string} s
 * @return {number}
 */
var minimumLength = function (s) {
	const n = s.length
	let left = 0,
		right = n - 1
	while (left < right && s[left] === s[right]) {
		const c = s[left]
		while (left <= right && s[left] === c) {
			left++
		}
		while (left <= right && s[right] === c) {
			right--
		}
	}
	return right - left + 1
}
const res = minimumLength('aca')
console.log('minimumLength :>>', res)
